﻿<%@ Page Language="C#" AutoEventWireup="false" CodeFile="recSanctionOpenform.aspx.cs"
    Inherits="SIPO.Web.Forms.Transaction.recSanctionOpenform" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Open Sanction Form</title>
    <link href="<%= ResolveUrl("~/styles/chosen/chosen.min.css") %>" rel="stylesheet"
        type="text/css" />
    <script src="<%= ResolveUrl("~/scripts/plupload/moxie.min.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveUrl("~/scripts/plupload/plupload.full.min.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveUrl("~/scripts/jquery.validate.min.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveUrl("~/scripts/jquery.validate.wrapper.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveUrl("~/scripts/jquery.inputmask.bundle.min.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveUrl("~/scripts/chosen/chosen.jquery.min.js") %>" type="text/javascript"></script>
    <script type="text/javascript">

        $(document).ready(function () {

            $("#btnSave").button({ icons: { primary: "ui-icon-disk"} });
            $("#btnClose").button({ icons: { primary: "ui-icon-close"} });

            $('#btnClose').click(function () {
                parent.$('#dialog').dialog("close");

                return false;
            });

        });
 
    </script>
    <script type="text/javascript">

        $(document).ready(function () {

            $("#txtValue").inputmask("decimal", { radixPoint: ",", autoGroup: true, groupSeparator: ".", groupSize: 3, digits: 2, repeat: 18 });

            $("#btnSave").click(function (e) {

                var tglreview = $('#<%= hdReviewDate.ClientID %>').val();
                var tglapprove = $('#<%= hdApproveDate.ClientID %>').val();
                var noinvoice = $('#<%= hfInvoiceNo.ClientID %>').val();
                if (noinvoice == "") {
                    if (tglapprove != "" || tglreview != "") {
                        var result = window.confirm('Benar data akan di buka ?');
                        if (result) {
                            OpenData();
                        }
                    }
                }
                else {
                    alert("Data tidak bisa di buka karena No. Surat Setoran sudah terdaftar !");
                }

                if (tglapprove == "" && tglreview == "") {
                    alert("Data sudah dalam keadaan terbuka !");
                }

            });

            function OpenData() {

                var id = $('#<%= hfID.ClientID %>').val();

                var objrecSanction = new Object();
                objrecSanction.SanctionID = id;

                jsonData = JSON.stringify(objrecSanction);

                var handlerUrl = '<%= ResolveUrl("~/ajaxhandler/transaction/recSanctionhandler.ashx") %>';

                CallAjax(handlerUrl, "?method=open", jsonData);

                parent.$('#dialog').dialog('close');
                setTimeout("parent.$('#table').trigger('reloadGrid');", 3000);

                return false;

            }

        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <table border="0">
        <tr>
            <td style="width: 50">
                Debitur
            </td>
            <td>
                :
            </td>
            <td>
                <asp:TextBox runat="server" Enabled="false" Width="300" ID="txtDebitur"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td style="width: 50">
                Sub Sektor
            </td>
            <td>
                :
            </td>
            <td>
                <asp:TextBox runat="server" Enabled="false" Width="300" ID="txtSubSector"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td style="width: 50">
                Sub Sub Sektor
            </td>
            <td>
                :
            </td>
            <td>
                <asp:TextBox runat="server" Enabled="false" Width="300" ID="txtSubSubSector"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td style="width: 50">
                Tipe Sanksi
            </td>
            <td>
                :
            </td>
            <td>
                <asp:TextBox runat="server" Enabled="false" Width="300" ID="txtTransType"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td style="width: 50">
                Jumlah
            </td>
            <td>
                :
            </td>
            <td>
                <asp:TextBox ID="txtValue" Style="text-align: right" Enabled="false" runat="server"
                    Width="200"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td style="width: 50">
                No. Surat Sanksi
            </td>
            <td>
                :
            </td>
            <td>
                <asp:TextBox ID="txtLetterNo" Enabled="false" runat="server" MaxLength="20" Width="100"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td style="width: 50">
                Tgl Surat Sanksi
            </td>
            <td>
                :
            </td>
            <td>
                <asp:TextBox ID="txtLetterDate" Enabled="false" runat="server" Width="100"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td style="width: 50">
                Lampiran
            </td>
            <td>
                :
            </td>
            <td>
                <asp:TextBox ID="txtFileName" Enabled="false" runat="server" Width="300"></asp:TextBox>
            </td>
        </tr>
        <tr runat="server" id="trInvoice" visible="false">
            <td style="width: 50">
                No. Surat Setoran
            </td>
            <td>
                :
            </td>
            <td>
                <asp:TextBox ID="txtInvoiceNo" Enabled="false" runat="server" Width="300"></asp:TextBox>
            </td>
        </tr>
        <tr runat="server" id="trInvoiceDate" visible="false">
            <td style="width: 50">
                Tgl. Surat Setoran
            </td>
            <td>
                :
            </td>
            <td>
                <asp:TextBox ID="txtInvoiceDate" Enabled="false" runat="server" Width="100"></asp:TextBox>
            </td>
        </tr>
        <tr runat="server" id="trPayment" visible="false">
            <td style="width: 50">
                No. Pembayaran
            </td>
            <td>
                :
            </td>
            <td>
                <asp:TextBox ID="txtPaymentNo" Enabled="false" runat="server" Width="300"></asp:TextBox>
            </td>
        </tr>
        <tr runat="server" id="trPaymentDate" visible="false">
            <td style="width: 50">
                Tgl Pembayaran
            </td>
            <td>
                :
            </td>
            <td>
                <asp:TextBox ID="txtPaymentDate" Enabled="false" runat="server" Width="100"></asp:TextBox>
            </td>
        </tr>
        <tr id="trReviewDate" runat="server" visible="false">
            <td style="width: 50">
                Tgl Review
            </td>
            <td>
                :
            </td>
            <td>
                <asp:TextBox ID="txtReviewDate" Enabled="false" runat="server" Width="100"></asp:TextBox>
            </td>
        </tr>
        <tr id="trReviewBy" runat="server" visible="false">
            <td style="width: 50">
                Direview oleh
            </td>
            <td>
                :
            </td>
            <td>
                <asp:TextBox ID="txtReviewBy" Enabled="false" runat="server" Width="100"></asp:TextBox>
            </td>
        </tr>
        <tr id="trApproveDate" runat="server" visible="false">
            <td style="width: 50">
                Tgl Persetujuan
            </td>
            <td>
                :
            </td>
            <td>
                <asp:TextBox ID="txtApproveDate" Enabled="false" runat="server" Width="100"></asp:TextBox>
            </td>
        </tr>
        <tr id="trApproveBy" runat="server" visible="false">
            <td style="width: 50">
                Disetujui oleh
            </td>
            <td>
                :
            </td>
            <td>
                <asp:TextBox ID="txtApproveBy" Enabled="false" runat="server" Width="100"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                &nbsp;
            </td>
            <td>
                <div style="text-align: right; padding-top: 10px;">
                    <button id="btnSave" type="button">
                        Buka</button>
                    <button id="btnClose" type="button">
                        Close</button>
                </div>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                &nbsp;
            </td>
            <td>
                <asp:HiddenField ID="hfID" runat="server" />
                <asp:HiddenField ID="hfInvoiceNo" runat="server" />
                <asp:HiddenField ID="hdReviewDate" runat="server" />
                <asp:HiddenField ID="hdApproveDate" runat="server" />
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
